package Text3;

import java.util.Arrays;

/*
 *@Student 张策
 */
public class wORK {
    public static void main(String[] args) {
        char[]carr={'a','s','d'};
        String string = carr.toString();
        System.out.println(string);
        String name="abcdefghijk";
        try {
            name= reverse(name,-1,7);
        } catch (Exception e) {
            System.out.println(e.getMessage());
            System.exit(-1);
        }
        System.out.println(name);
    }
    public static String reverse(String str,int a,int b){
        if(!(str!=null&&a>0&&b>a)){
            throw new RuntimeException("参数不正确");
        }
        char[] charArray = str.toCharArray();
        char tem;
        while (a<b) {
            tem=charArray[a];
            charArray[a]=charArray[b];
            charArray[b]=tem;
            a++;
            b--;
        }
        return new String(charArray);
    }
}
